eeprom17 2.2.0
Loading...
Searching...
No Matches
eeprom17


EEPROM 17 Click

EEPROM 17 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Apr 2025.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of EEPROM 17 Click board by writing specified data to the memory and reading it back.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.EEPROM17

Example Key Functions

  • eeprom17_cfg_setup This function initializes Click configuration structure to initial values.
    void eeprom17_cfg_setup(eeprom17_cfg_t *cfg)
    EEPROM 17 configuration object setup function.
    EEPROM 17 Click configuration object.
    Definition eeprom17.h:156
  • eeprom17_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t eeprom17_init(eeprom17_t *ctx, eeprom17_cfg_t *cfg)
    EEPROM 17 initialization function.
    EEPROM 17 Click context object.
    Definition eeprom17.h:139
  • eeprom17_write_memory This function writes data to the EEPROM memory starting from the specified address.
    err_t eeprom17_write_memory ( eeprom17_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len );
    err_t eeprom17_write_memory(eeprom17_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len)
    EEPROM 17 Write Memory function.
  • eeprom17_read_memory This function reads data from the EEPROM memory starting from the specified address.
    err_t eeprom17_read_memory ( eeprom17_t *ctx, uint8_t address, uint8_t *data_out, uint16_t len );
    err_t eeprom17_read_memory(eeprom17_t *ctx, uint8_t address, uint8_t *data_out, uint16_t len)
    EEPROM 17 Read Memory function.
  • eeprom17_select_bank This function selects the active memory bank in the EEPROM.
    err_t eeprom17_select_bank ( eeprom17_t *ctx, uint8_t bank_sel );
    err_t eeprom17_select_bank(eeprom17_t *ctx, uint8_t bank_sel)
    EEPROM 17 Select Memory Bank function.

Application Init

Initializes the driver and logger.

void application_init ( void )
{
log_cfg_t log_cfg;
eeprom17_cfg_t eeprom17_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
eeprom17_cfg_setup( &eeprom17_cfg );
EEPROM17_MAP_MIKROBUS( eeprom17_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == eeprom17_init( &eeprom17, &eeprom17_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define EEPROM17_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition eeprom17.h:126
void application_init(void)
Definition main.c:33

Application Task

Writes a desired number of bytes to the memory and then verifies if it is written correctly by reading from the same memory location and displaying the memory content on the USB UART.

void application_task ( void )
{
static uint8_t bank_sel = EEPROM17_BANK_SEL_0;
uint8_t data_buf[ EEPROM17_MEM_PAGE_SIZE + 1 ] = { 0 };
// Selecting memory bank
eeprom17_select_bank ( &eeprom17, bank_sel );
log_printf ( &logger, "\r\n Memory bank: %u\r\n", ( uint16_t ) bank_sel );
log_printf ( &logger, " Memory address: 0x%.2X\r\n", ( uint16_t ) STARTING_ADDRESS );
bank_sel ^= EEPROM17_BANK_SEL_1;
// Write/Read first iterration
{
}
else
{
memcpy ( data_buf, DEMO_TEXT_MESSAGE_1, strlen ( DEMO_TEXT_MESSAGE_1 ) );
}
{
log_printf ( &logger, " Write data: %s\r\n", data_buf );
}
Delay_ms ( 100 );
memset ( data_buf, 0, sizeof ( data_buf ) );
{
log_printf ( &logger, " Read data: %s\r\n", data_buf );
}
Delay_ms ( 100 );
// Write/Read second iterration
{
}
else
{
memcpy ( data_buf, DEMO_TEXT_MESSAGE_2, strlen ( DEMO_TEXT_MESSAGE_2 ) );
}
{
log_printf ( &logger, " Write data: %s\r\n", data_buf );
}
Delay_ms ( 100 );
memset ( data_buf, 0, sizeof ( data_buf ) );
{
log_printf ( &logger, " Read data: %s\r\n", data_buf );
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
@ EEPROM17_OK
Definition eeprom17.h:173
#define EEPROM17_BANK_SEL_1
Definition eeprom17.h:100
#define EEPROM17_MEM_PAGE_SIZE
Definition eeprom17.h:92
#define EEPROM17_BANK_SEL_0
EEPROM 17 bank selection setting.
Definition eeprom17.h:99
void application_task(void)
Definition main.c:63
#define DEMO_TEXT_MESSAGE_2
Definition main.c:27
#define DEMO_TEXT_MESSAGE_1
Definition main.c:26
#define STARTING_ADDRESS
Definition main.c:28

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.